PBFlushFileSync
PBFlushFile Write contents of the file buffer to disk
#include <Files.h> File Manager (PBxxx)
OSErr PBFlushFile(pb, async );
ParmBlkPtr pb ; address of a 50-byte IOParam structure
Boolean async ; 0=await completion; 1=immediate return
returns Error Code; 0=no error
PBFlushFile writes the current contents of an open file's buffer to disk.
Call it occasionally to help ensure file integrity in the event of a system crash.
pb is the address of a 50-byte IOParam structure. The relevant fields
are as follows:
Out-In Name Type Size Offset Description
-> ioCompletion ProcPtr 4 12 Completion routine address (if async =TRUE)
-> ioRefNum short 2 24 File reference number of file to flush
<- ioResult OSErr 2 16 Error Code (0=no error, 1=not done yet)
async is a Boolean value. Use FALSE for normal (synchronous) operation
or TRUE to enqueue the request and resume control immediately. See
Async I/O.
Returns: an operating system Error Code. It will be one of:
noErr (0) No error
extFSErr (-58) External file system
fnfErr (-43) File not found
fnOpnErr (-38) File not open
ioErr (-36) I/O error
nsvErr (-35) No such volume
rfNumErr (-51) Bad ioRefNum

Notes: PBFlushFile can be faster than PBFlushVol, since it does not update all
files on the volume nor does it store volume and directory de scriptive
information. Use PBFlushVol occasionally to ensure that the disk is
up-to-date.
You may want to use async =TRUE and set ioCompletion=0 to avoid program
delays. See Async I/O.